<#include "../common/common.html"/> <@layout>
<script type="text/javascript">
    /**
     * 保存新增的用户数据，并对登录密码进行校验
     */
    function saveModel() {
        $('#myform').form('submit', {
            url : '${ctx}/generat/create',
            onSubmit : function() {
                $('#tables').val($('#tablename').combogrid('getValues').join(','));
                return $(this).form('validate');
            },
            success : function(data) {
                $.messager.show({ // show error message
                    title : '提示',
                    msg : data,
                    timeout:2000
                });
                $('#dlg').dialog('close');
            }
        });
    }

    $(function(){
        $('#tablename').combogrid({
            multiple:true,
            idField:'sqlName',
            textField:'remarks',
            url:'${ctx}/generat/tables',
            columns:[[
                {checkbox:true},
                {field:'sqlName',title:'字段名',width:100},
                {field:'remarks',title:'中文名',width:120}
            ]]
        });
    });
</script>
<body style="padding: 20px;">
	<div class="easyui-panel" title="根据表元数据生成后台和前端页面"
		style="width: 500px; height: 300px; background: #fafafa;">
		<form id="myform" method="post">
			<input type="hidden" id="tables" name="tables" />
			<table cellpadding="0" cellspacing="0" class="form-table"
				align='center'>
				<tr>
					<td style="width: 60px">表名：</td>
					<td style="width: 180px"><input id='tablename'
						name="tablename" style="width: 325px" /></td>
				</tr>
				<tr>
					<td style="width: 60px">基础目录：</td>
					<td style="width: 180px"><input id='basepackage'
						name="basepackage" value="com.xinan" style="width: 325px" /></td>
				</tr>
				<tr>
					<td style="width: 60px">子目录：</td>
					<td style="width: 180px"><input id='subpackage'
						name="subpackage" value="test" style="width: 325px" /></td>
				</tr>
				<tr>
					<td colspan="2"><a href="#" class="easyui-linkbutton"
						onclick="saveModel()">生成</a></td>
				</tr>
			</table>
		</form>
	</div>
</body>
</@layout>
